package com.mingqijia.gassafety.webserver.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mingqijia.gassafety.db.entity.Idmap;
import com.mingqijia.gassafety.db.mapper.IdmapMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author zhangfei
 * @version 1.0.0
 * @ClassName IdmapServiceImpl.java
 * @createTime 2022年06月01日
 */
@Service
@Slf4j
@DS("db4")
public class IdmapServiceImpl extends ServiceImpl<IdmapMapper, Idmap> implements IService<Idmap> {

    @Autowired
    private IdmapMapper idmapMapper;


    @Transactional(propagation = Propagation.REQUIRES_NEW)
    public void deleteData(String imei) {
        idmapMapper.deleteData(imei);
    }


    @Transactional(propagation = Propagation.REQUIRES_NEW)
    public void saveData(Idmap idmap) {
        log.info("saveData-idmap:{}", JSONObject.toJSONString(idmap));
        idmapMapper.saveData(idmap);
    }
}